﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyManagement.aspx.cs"
    Inherits="BEGDC.CC.Web.CIS2.Admin.CompanyManagement" %>

<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="ASBCC.Database.EntityFramework" %>
<%@ Register Src="../../../UserControls/Pager.ascx" TagName="Pager" TagPrefix="cc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../../css/global.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/entity.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />

    <script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../../../js/jquery-ui.min.js" type="text/javascript"></script>

    <script src="../../../js/entity.js.aspx" type="text/javascript"></script>

</head>
<body>
    <form runat="server">
    <div class="mainbox">
        <div class="sitemapbox">
            <div id="info" class="sitemap">
                &nbsp;&raquo;&nbsp;Administration&nbsp;&raquo;&nbsp;Company Name Management
            </div>
        </div>
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <!--tab区域-->
                    <div class="tabbox purplebg_dark">
                        <ul class="tabpos">
                            <li><span class="tab_active">
                                <%=Resources.PageTitles.CompanyNameManagement%></span></li>
                        </ul>
                    </div>
                    <div class="formbox">
                        <span class=" float_lft">
                            <div class="formbox_float_lft">
                                <asp:Button ID="BtnAdd" runat="server" CssClass="entity-add" />
                            </div>
                            <div class="formbox_float_rgt">
                                <asp:TextBox ID="SearchText" runat="server" CssClass="txtbox width140 entity-search-text"
                                    ToolTip="Name,Description"></asp:TextBox>
                                <asp:Button ID="Searchbtn" runat="server" CssClass="entity-search" />
                                <asp:Button ID="Cleanbtn" runat="server" CssClass="entity-clear" />
                            </div>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
        <table width="100%" id="Table1" cellspacing="0" cellpadding="0" border="0">
            <tbody>
                <tr>
                    <td>
                        <asp:GridView ID="gvCompany" runat="server" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="False" DataKeyNames="CompanyID" DataSourceID="edsCompany"
                            EmptyDataText="There is no data to display!" CssClass="tablestyle">
                            <RowStyle CssClass="tbody" />
                            <HeaderStyle CssClass="thead" ForeColor="#ffffff" />
                            <Columns>
                                <asp:BoundField DataField="Name" HeaderText="Company Name<br/>公司名称" HtmlEncode="false"
                                    SortExpression="Name" />
                                <asp:TemplateField HeaderText="PCAT<br/>公司所属PCAT">
                                    <ItemTemplate>
                                        <asp:Repeater runat="server" DataSource='<%# GetPCAT(EvalX("PCATs")) %>'>
                                            <ItemTemplate>
                                                <%#Eval("Province.Name")%><%#Eval("Category.Name")%>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:ActionField HeaderText="Action<br />操作" ShowViewButton="true" ShowModifyButton="true"
                                    ShowDisableButton="true" HeaderStyle-CssClass="entity-action" />
                            </Columns>
                            <PagerTemplate>
                                <cc:Pager runat="server" />
                            </PagerTemplate>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DetailsView ID="dvCompany" runat="server" AutoGenerateRows="False" DataKeyNames="CompanyID"
                            DataSourceID="edsCompany" EnableModelValidation="True" Visible="False" CssClass="tablestyle2">
                            <HeaderStyle CssClass="tablestyle2_Title"></HeaderStyle>
                            <HeaderTemplate>
                                <%=Resources.PageTitles.CompanyNameManagement%>
                            </HeaderTemplate>
                            <FieldHeaderStyle CssClass="tablestyle2_tdTitle" />
                            <Fields>
                                <asp:CustomizeBoundField DataField="Name" HeaderText="Company Name (公司名称):" HtmlEncode="false"
                                    SortExpression="Name" ItemStyle-CssClass="entity-notnull-check entity-length-check"
                                    MaxLength="100" />
                                <asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="PCAT (公司所属PCAT):"
                                    ItemStyle-CssClass="entity-radios-check">
                                    <ItemTemplate>
                                        <asp:Repeater runat="server" DataSource='<%# GetPCAT(EvalX("PCATs")) %>'>
                                            <ItemTemplate>
                                                <div class="checkbox-class">
                                                    <%#Eval("Province.Name")%><%#Eval("Category.Name")%>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:Repeater runat="server" DataSourceID="odsPCAT">
                                            <ItemTemplate>
                                                <div class="checkbox_class180">
                                                    <input type="radio" name="radioPCAT" value="<%# Eval("PCID") %>" <%#Eval("ContainsCompany") %> /><%# Eval("ProvinceName")%><%# Eval("CategoryName")%>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:Repeater runat="server" DataSourceID="odsPCAT">
                                            <ItemTemplate>
                                                <div class="checkbox_class180">
                                                    <input type="radio" name="radioPCAT" value="<%# Eval("PCID") %>" /><%# Eval("ProvinceName")%><%# Eval("CategoryName")%>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </InsertItemTemplate>
                                </asp:TemplateField>
                                <asp:ActionField ShowEditButton="true" ShowInsertButton="true" ShowInsertMoreButton="true"
                                    ShowCloseButton="true" />
                            </Fields>
                        </asp:DetailsView>
                        &nbsp;
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <%--以下是数据源--%>
    <asp:EntityDataSource ID="edsCompany" runat="server" ConnectionString="name=CCEntities"
        DefaultContainerName="CCEntities" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
        EntitySetName="Companies" Where="it.Disabled = false" Include="LastModifyBy,PCATs"
        OnInserted="edsCompany_Inserted" OnUpdated="edsCompany_Updated">
    </asp:EntityDataSource>
    <asp:ObjectDataSource ID="odsPCAT" runat="server" SelectMethod="GetPCATsWithCompanyRelation"
        TypeName="ASBCC.Business.CIS.CompanyManagementHelper">
        <SelectParameters>
            <asp:ControlParameter ControlID="dvCompany" Name="companyID" PropertyName="DataKey.Value"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:EntityDataSource ID="edsPCAT" runat="server" ConnectionString="name=CCEntities"
        DefaultContainerName="CCEntities" EnableInsert="True" EnableUpdate="True" EntitySetName="Provinces"
        Where="!it.Disabled">
    </asp:EntityDataSource>
    </form>
    <%--页面刷新时显示--%>
    <div id="dialog-message" title="Loading..." style="display: none">
        <p>
            <br />
            <span class="entity-loading"></span><span>Operation in process, please wait...<br />
                <br />
                处理中, 请稍候。。。</span>
        </p>
    </div>
</body>
</html>
